<div class="section">
  <div class="section-title"> Khách Hàng Chưa Có Nhân Viên Phụ Trách </div>
  <div class="section-content padding1">
    <form id="frmdanhsachkh" method="post" name="frmdanhsachkh" class="text-center">
    <?php 
    	if($_GET['print'] !="true" )
        { 
    ?> 
      <div class="right">
       <a id="btnluu" class="button add" >Lưu</a>
       <a id="btnPrint" class="button print">In</a>        
       <a href="?route=deliman/chiakhachhangchonhanvienphutrachphathanh&khuvucid=<?php echo $_GET['khuvucid'] ?>"  class="button exit" >Đóng</a>
      </div>
     <?php }?> 
      <div class="clearer">&nbsp;</div>
      <div>
      <table width="100%" class="data-table">
        <thead>
          <tr>
            <th>Mã KH</th>
            <th>Tên KH</th>
            <th>Địa chỉ</th>
            <th>Điện thoại</th>
            <th>Nhân viên phụ trách</th>
            <th>Chuyển nhanh</th>
          </tr>
        </thead>
        <tbody>
          <?php foreach($khuvuckhachhangs as $khuvuckhachhang) {
          ?>
          <tr>
            <th colspan="7"><?php echo $khuvuckhachhang['tenkhuvuc']?></th>
          </tr>
          <?php foreach($khachhangmois as $khachhangmoi) {
                if($khachhangmoi['khuvucid']==$khuvuckhachhang['khuvucid'])
                {
          ?>
          <tr>
            <td><?php echo $khachhangmoi['masokhachhang']?></td>
            <td><?php echo $khachhangmoi['hoten']?></td>
            <td><?php echo $khachhangmoi['diachi']?></td>
            <td><?php echo $khachhangmoi['dienthoai']?></td>
            <td><div class="text-center ">
                <?php 
            echo $nhanvien_phutrach['hoten'];
            ?>
              </div></td>
            <td><select name="nhanvienphutrach[<?php echo $khachhangmoi['khachhangid']?>]" class="cbnhanvien    "  title="<?php echo $khachhangmoi['nhanvienphutrachid'] ?>">
                <option value="0">---Chọn nhân viên---</option>
                <?php foreach($nhanvienphutrachids as $nhanvienphutrachid) {?>
                <option value="<?php echo $nhanvienphutrachid['nhanvienid']?>">
                	<?php echo $nhanvienphutrachid['hoten']." (".$nhanvienphutrachid['userid'].")"?>
                </option>
                <?php }?>
              </select></td>
          </tr>
          <?php
          			}
          		}
           }
           ?>
        </tbody>
      </table>
    </form>
  </div>
</div>
<div class="section-bottom"></div>
</div>
<script language="javascript">
		//start script
$(document).ready(function(){

			$('.cbnhanvien').val("<?php echo $_GET['nhanvienid'] ?>");
			
			$('.cbnhanvien').change(function(){
					var id=$(this).attr('title');
					
				
				});
				
			$('#btnluu').click(function(){
					var url='?route=deliman/chiakhachhangdetail/saveKhachhang';
					$.post(url,$('#frmdanhsachkh').serialize(),function(){
						document.location.reload();
						
						});
				
				});	
				
			$('#btnPrint').click(function(){
			
			var url = window.location+"&print=true";
			 var result = window.showModalDialog(url,"", "dialogWidth:1000px; dialogHeight:800px; center:yes");
			});		

});
</script> 
</script>
<?php if($_GET['print'] =="true" ){ ?>
<script language="javascript">
        window.print();
    </script>
<?php } ?>
